package com.gsbelarus.gedemin.salary.entity.model;

import com.google.gson.annotations.Expose;

import java.io.Serializable;
import java.util.Date;

import io.realm.RealmObject;
import io.realm.annotations.Ignore;
import io.realm.annotations.PrimaryKey;

public class GdMsgModel extends RealmObject implements Serializable {

    public enum RequestStatus {SUCCESS, ERROR, REJECTED, UNKNOWN}

    public enum Subject {INCOME, HOLIDAY, VACATION, CHANGE_USER_PROFILE, CHANGE_WORK_SCHEDULE, INFO}

    public enum Sender {CLIENT, SERVER}

    ///TODO EmployeeModel
    @Ignore
    private RequestStatus requestStatus;
    @Expose
    private int requestStatusIndex;
    @Ignore
    private Subject subject;
    @Expose
    private int subjectIndex;
    @Ignore
    private Sender sender;
    @Expose
    private int senderIndex;

    @PrimaryKey
    @Expose
    private int uid;

    @Expose
    private boolean isUnread;
    @Expose
    private Date timestamp;
    @Expose
    private String msg = "";
    @Expose
    private String comment = "";

    private String gdMsgString = "";

    //TODO переделать
    @Expose
    private GdMsgEmployeeModel gdMsgEmployeeModel;
    @Expose
    private GdMsgHolidayModel gdMsgHolidayModel;
    @Expose
    private GdMsgIncomeModel gdMsgIncomeModel;
    @Expose
    private GdMsgVacationModel gdMsgVacationModel;
    @Expose
    private GdMsgWorkScheduleModel gdMsgWorkScheduleModel;
    @Expose
    private GdMsgInfoModel gdMsgInfoModel;

    public RequestStatus getRequestStatus() {
        return RequestStatus.values()[getRequestStatusIndex()];
    }

    public void setRequestStatus(RequestStatus requestStatus) {
        setRequestStatusIndex(requestStatus.ordinal());
    }

    public Subject getSubject() {
        return Subject.values()[getSubjectIndex()];
    }

    public void setSubject(Subject subject) {
        setSubjectIndex(subject.ordinal());
    }

    public Sender getSender() {
        return Sender.values()[getSenderIndex()];
    }

    public void setSender(Sender sender) {
        setSenderIndex(sender.ordinal());
    }

    // generated getters & setters

    public int getSenderIndex() {
        return senderIndex;
    }

    public void setSenderIndex(int senderIndex) {
        this.senderIndex = senderIndex;
    }

    public int getRequestStatusIndex() {
        return requestStatusIndex;
    }

    public void setRequestStatusIndex(int requestStatusIndex) {
        this.requestStatusIndex = requestStatusIndex;
    }

    public int getSubjectIndex() {
        return subjectIndex;
    }

    public void setSubjectIndex(int subjectIndex) {
        this.subjectIndex = subjectIndex;
    }

    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    public Date getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Date timestamp) {
        this.timestamp = timestamp;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public void setIsUnread(boolean isUnread) {
        this.isUnread = isUnread;
    }

    public boolean isUnread() {
        return isUnread;
    }

    public GdMsgEmployeeModel getGdMsgEmployeeModel() {
        return gdMsgEmployeeModel;
    }

    public void setGdMsgEmployeeModel(GdMsgEmployeeModel gdMsgEmployeeModel) {
        this.gdMsgEmployeeModel = gdMsgEmployeeModel;
    }

    public GdMsgHolidayModel getGdMsgHolidayModel() {
        return gdMsgHolidayModel;
    }

    public void setGdMsgHolidayModel(GdMsgHolidayModel gdMsgHolidayModel) {
        this.gdMsgHolidayModel = gdMsgHolidayModel;
    }

    public GdMsgIncomeModel getGdMsgIncomeModel() {
        return gdMsgIncomeModel;
    }

    public void setGdMsgIncomeModel(GdMsgIncomeModel gdMsgIncomeModel) {
        this.gdMsgIncomeModel = gdMsgIncomeModel;
    }

    public GdMsgVacationModel getGdMsgVacationModel() {
        return gdMsgVacationModel;
    }

    public void setGdMsgVacationModel(GdMsgVacationModel gdMsgVacationModel) {
        this.gdMsgVacationModel = gdMsgVacationModel;
    }

    public GdMsgWorkScheduleModel getGdMsgWorkScheduleModel() {
        return gdMsgWorkScheduleModel;
    }

    public void setGdMsgWorkScheduleModel(GdMsgWorkScheduleModel gdMsgWorkScheduleModel) {
        this.gdMsgWorkScheduleModel = gdMsgWorkScheduleModel;
    }

    public GdMsgInfoModel getGdMsgInfoModel() {
        return gdMsgInfoModel;
    }

    public void setGdMsgInfoModel(GdMsgInfoModel gdMsgInfoModel) {
        this.gdMsgInfoModel = gdMsgInfoModel;
    }

    public String getGdMsgString() {
        return gdMsgString;
    }

    public void setGdMsgString(String gdMsgString) {
        this.gdMsgString = gdMsgString;
    }
}
